__author__ = 'drazen.popovic'

from config import TXN_LOGGERS

class Transaction():
    _dtSms = None
    _dtEntrance = None
    _dtPay = None
    _dtLeave = None
    _dtExit = None
    _intImsi = None
    _strMsIsdn = None
    _strGkId = None
    _strIptId = None
    _dblAmount = None
    _strCurrency = None

    def __init__(self):
        pass
    def setImsi(self, intImsi):
        self._intImsi = intImsi
    def setMsisdn(self, strMsIsdn):
        self._strMsIsdn = strMsIsdn
    def setGkId(self, strGkId):
        self._strGkId = strGkId
    def setIptId(self, strIptId):
        self._strIptId = strIptId
    def setSmsDatetime(self, dtSms):
        self._dtSms = dtSms
    def setEnterenceDatetime(self, dtEnterence):
        self._dtEnterence = dtEnterence
    def setPayDatetime(self, dtPay):
        self._dtPay = dtPay
    def setLeaveDatetime(self, dtLeave):
        self._dtLeave = dtLeave
    def setExitDatetime(self, dtExit):
        self._dtExit = dtExit
    def setAmount(self, dblAmount):
        self._dblAmount = dblAmount
    def setCurrency(self, strCurrency):
        self._strCurrency = strCurrency
    def getImsi(self):
        return self._intImsi
    def getMsisdn(self):
        return self._strMsIsdn
    def getGkId(self):
        return self._strGkId
    def getIptId(self):
        return self._strIptId
    def getSmsDatetime(self):
        return self._dtSms
    def getEnterenceDatetime(self):
        return self._dtEnterence
    def getPayDatetime(self):
        return self._dtPay
    def getLeaveDatetime(self):
        return self._dtLeave
    def getExitDatetime(self):
        return self._dtExit
    def getAmount(self):
        return self._dblAmount
    def getCurrency(self):
        return self._strCurrency
    def save(self):
        for sTrxLoggerName in TXN_LOGGERS:
            sTrxLoggerMod = "TransactionLoggers.{0}".format(sTrxLoggerName)
            modTrxLogger = __import__(sTrxLoggerMod, fromlist=[sTrxLoggerName])
            cTrxLogger = getattr(modTrxLogger, sTrxLoggerName)
            trxlogger = cTrxLogger()
            trxlogger.save(self)
    def __str__(self):
        return "{0:s}".format(
            str(self.getAmount()))